﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using DTO_HealthInsurance;
using BLL_HealthInsurance;

namespace HealthInsuranceMgm.Admin
{
    public partial class Searchpolicy : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
         
        }

        protected void radsearchAmount_CheckedChanged(object sender, EventArgs e)
        {
            txtsearchpolicy.Enabled = false;
        }

        protected void radsearchname_CheckedChanged(object sender, EventArgs e)
        {
            DropDownList1.Enabled = false;
            DropDownList2.Enabled = false;
            txtsearchpolicy.Enabled = true;
        }

        protected void btnsearch_Click(object sender, EventArgs e)
        {
            BLLPolicies obj = new BLLPolicies();
            DTOPolicies objdto = new DTOPolicies();
          if(radsearchname.Checked==true){
       
              objdto.PolicyName = txtsearchpolicy.Text;

              grvpolicyResult.DataSource = obj.GetPolicyByname(objdto);
              grvpolicyResult.DataBind();
          }
          else if(radsearchAmount.Checked==true){
              float minamount = float.Parse(DropDownList1.SelectedValue.ToString());
              float maxamount = float.Parse(DropDownList2.SelectedValue.ToString());
              grvpolicyResult.DataSource = obj.GetPolicyByAmount(minamount, maxamount);
              grvpolicyResult.DataBind();
            }
          
            
            
        }

        
    }
}